package com.heima.wemedia.feign;

import com.heima.feign.wemedia.INewsClient;
import com.heima.model.apuser.dtos.NewsAuthDto;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.wemedia.service.WmNewsService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author rookie001
 * @creat 2023-06-20-15:38
 */
@RestController
@Slf4j
public class WmNewsClient implements INewsClient {
    @Autowired
    private WmNewsService wmNewsService;

    @PostMapping("/api/v1/news/list_vo")
    public ResponseResult getNewsList(@RequestBody NewsAuthDto dto) {
        return wmNewsService.getNewsList(dto);
    }

    //查询详情
    @GetMapping("/api/v1/news/one_vo/{id}")
    public ResponseResult getNewsDetail(@PathVariable("id") Integer id) {
        return wmNewsService.getNewsDetail(id);
    }

    //文章审核驳回
    @PostMapping("/api/v1/news/auth_fail")
    public ResponseResult auditReject(@RequestBody NewsAuthDto dto) {
        return wmNewsService.auditReject(dto);
    }

    //文章审核通过
    @PostMapping("/api/v1/news/auth_pass")
    public ResponseResult auditPass(@RequestBody NewsAuthDto dto) {
        return wmNewsService.auditPass(dto);
    }

}
